/***********************************************************************
 * Module:  Image.java
 * Author:  zhangpei
 * Purpose: Defines the Class Image
 ***********************************************************************/

package com.afteryuan.engine.model;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;

@Entity
@DiscriminatorValue("Image")
public class Image extends File implements Cloneable {

	public static final Integer IMAGE_DISPLAY = 0;
	public static final Integer IMAGE_ICON = 1;
	public static final Integer IMAGE_PLATE = 2;
	public static final String[] IMAGE_TYPE = {"显示图片","图标图片","图板图片"};
	
	public static final Integer IMAGE_JPG = 0 ;
	public static final Integer IMAGE_GIF = 1 ;	
	public static final Integer IMAGE_PNG = 2 ;
	
	public static final String[] IMAGE_IMAGETYPE = {"jpg","gif","png"};
	/** 图片高度 */
	private Integer height;

	/** 图片宽度 */
	private Integer width;

	/** 图片格式(gif,jpg) */
	private Integer imageType;

	/** mouseOnover的时候显示 */
	private java.lang.String alt;

	/** 低质量图片源 */
	private Image repalce;
	
	/** 图片类型(0显示,1图标,2图板) */
	private Integer type;



	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public Image() {
		super();
	}

	public Image(String id) {
        super(id);
	}

	public java.lang.String getAlt() {
		return alt;
	}

	public void setAlt(java.lang.String alt) {
		this.alt = alt;
	}



	public Integer getHeight() {
		return height;
	}

	public void setHeight(Integer height) {
		this.height = height;
	}
    @ManyToOne
    @JoinColumn(name = "REPLACEID")
	public Image getRepalce() {
		return repalce;
	}

	public void setRepalce(Image repalce) {
		this.repalce = repalce;
	}

	public Integer getImageType() {
		return imageType;
	}

	public void setImageType(Integer imageType) {
		this.imageType = imageType;
	}

	public Integer getWidth() {
		return width;
	}

	public void setWidth(Integer width) {
		this.width = width;
	}
	@Transient
	public String getFriendlyType(){
		return IMAGE_TYPE[type];
	}
	@Transient
	public String getFriendlyImageType(){
		return IMAGE_TYPE[imageType];
	}
	
	public Object clone() throws CloneNotSupportedException {
    	Image img = (Image)(super.clone());    	
    	return img;
    }

}